package chapter02;

import java.util.Scanner;

public class Access {
    public static void main(String[] args) {
        // 华为
        double huaweiPrice = 3688.88;
        int huaweiKucun = 0;
        double totalPrice = 0;
        System.out.println("品牌型号:华为");
        System.out.println("尺寸:5.5");
        System.out.println("价格:" + huaweiPrice);
        System.out.println("配置:8G+128G 全面刘海屏");
        System.out.println("请输入华为手机库存数量");
        /** 引入Scanner类
         * 定义Scanner类变量scl
         * 使用类必须实例化 new Scanner();
         * Scanner使用系统终端输入 System.in
         */
        Scanner scl = new Scanner(System.in);
        // 将用户输入以整型存入变量
        huaweiKucun = scl.nextInt();
        totalPrice = huaweiPrice * huaweiKucun;// 计算华为总价
        System.out.println("库存华为手机的总金额:" + totalPrice);
        // 小米
        double xiaomiPrice = 2988.88;
        int xiaomiKucun = 0;
        double xiaomiTotalPrice = 0;
        System.out.println("品牌型号:小米");
        System.out.println("尺寸:5.0");
        System.out.println("价格:" + xiaomiPrice);
        System.out.println("配置:4+64G 全面屏");
        System.out.println("请输入小米手机库存数量");
        xiaomiKucun = scl.nextInt();
        xiaomiTotalPrice = xiaomiPrice * xiaomiKucun;
        System.out.println("库存华为手机的总金额:" + xiaomiTotalPrice);
        // 商品清单
        System.out.println("---------库存清单---------");
        System.out.println("品牌型号  尺寸 价格 配置      库存 总价");
        System.out.println("华为      5.5 " + huaweiPrice + " 8G+128G 全面刘海屏 "
                + huaweiKucun + " " + totalPrice);
        System.out.println("小米      5.0 " + xiaomiPrice + " 4+64G 全面屏 "
                + xiaomiKucun + " " + xiaomiTotalPrice);
        System.out.println("----------------------");

        System.out.println("商品总库存:" +(huaweiKucun+xiaomiKucun));
        System.out.println("商品总金额:" +(totalPrice+xiaomiTotalPrice) + "￥");
    }
}
